// 论坛动作
// by indraw 2013.02.01
package bbs

import (
    //"fmt"
)

//用户分组
type Action struct{
    Dao
    ActionData
}

//论坛动作
type ActionData struct{
    Actid string
    Intro string   //介绍
    Cbcredit int   //贡献
    Credit  int    //积分
    Type int       //积分类型
    Order int      //显示顺序
}

/**
 * 初始化对象
 *
 * author: indraw
 * date: 2013-02-11
 */
func newAction() *Action {
    
    c := &Action{
        Dao{
            c:db.C("action"),
        },
        ActionData{
            Actid:"",
            Intro:"",
            Cbcredit:0,
            Credit:0,
            Type:0,
            Order:0,
        },
    }
    return c
}


/**
 * 写入数据库
 *
 * author: indraw
 * date: 2013-02-11
 */
func (a *Action) add() error {
    

    return nil
}

/**
 * 获取一条记录
 *
 * author: indraw
 * date: 2013-02-11
 */
func (a *Action) get() error {
    //fmt.Println("user.go")
    
    return nil
}


/**
 * 删除一条记录
 *
 * author: indraw
 * date: 2013-02-11
 */
func (a *Action) count() error {

    
    return nil
}

/**
 * 获取前多少条记录
 *
 * author: indraw
 * date: 2013-02-11
 */
func (a *Action) top() []ActionData {
    var l []ActionData
    a.c.Find(nil).Sort("order").All(&l)

    return l
}

/**
 * 更新一条记录
 *
 * author: indraw
 * date: 2013-02-11
 */
func (a *Action) update() error {
    //fmt.Println("user.go")
    
    return nil
}

/**
 * 删除一条记录
 *
 * author: indraw
 * date: 2013-02-11
 */
func (a *Action) delete() error {
    //fmt.Println("user.go")
    
    return nil
}


